﻿// ParseLib - An open source library for natural language processing.
// Copyright (C) Kais Dukes, 2012. E-mail: kais@kaisdukes.com
// http://parselib.org

using System.Collections.Generic;
using System.Linq;
using ParseLib.Algorithms;

namespace ParseLib.Corpora
{
    public class CorpusPartition : Partition
    {
        public ICorpus Corpus { get; private set; }

        public CorpusPartition(int partitionNumber, int partitionCount, ICorpus corpus)
            : base(partitionNumber, partitionCount, corpus.TextualUnitCount)
        {
            Corpus = corpus;
        }

        public IEnumerable<TextualUnit> TestData
        {
            get { return Inside.Select(index => Corpus[index]); }
        }

        public IEnumerable<TextualUnit> TrainingData
        {
            get { return Outside.Select(index => Corpus[index]); }
        }
    }
}
